Show the code
import pandas as pd
import numpy as np
from lets_plot import *
LetsPlot.setup_html(isolated_frame=True)import pandas as pd
import numpy as np
from lets_plot import *
LetsPlot.setup_html(isolated_frame=True)# Learn morea about Code Cells: https://quarto.org/docs/reference/cells/cells-jupyter.html
# Include and execute your code here
from palmerpenguins import load_penguins
df = load_penguins()Include the tables created from PY4DS: CH2 Data Visualization used to create the above chart (Hint: copy the code from 2.2.1. The penguins data frame and paste each in the cells below)
# Include and execute your code here
df.head()| species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex | year | |
|---|---|---|---|---|---|---|---|---|
| 0 | Adelie | Torgersen | 39.1 | 18.7 | 181.0 | 3750.0 | male | 2007 |
| 1 | Adelie | Torgersen | 39.5 | 17.4 | 186.0 | 3800.0 | female | 2007 |
| 2 | Adelie | Torgersen | 40.3 | 18.0 | 195.0 | 3250.0 | female | 2007 |
| 3 | Adelie | Torgersen | NaN | NaN | NaN | NaN | NaN | 2007 |
| 4 | Adelie | Torgersen | 36.7 | 19.3 | 193.0 | 3450.0 | female | 2007 |
include figures in chunks and discuss your findings in the figure.
# Include and execute your code here
print("""The Palmer Penguins dataset contains information about three penguin species (Adelie, Chinstrap, and Gentoo).
It includes measurements like flipper length, bill depth, and body mass.
There are some missing values (NaNs) present in the dataset.""")The Palmer Penguins dataset contains information about three penguin species (Adelie, Chinstrap, and Gentoo).
It includes measurements like flipper length, bill depth, and body mass.
There are some missing values (NaNs) present in the dataset.
Recreate the example charts from PY4DS: CH2 Data Visualization of the textbook. (Hint: copy the chart code from 2.2.3. Creating a Plot, one for each cell below)
# Include and execute your code here
(ggplot(df, aes(x="flipper_length_mm", y="body_mass_g"))
+ geom_point()
)This chart compares the weight to flipper length of each species of penguin. include figures in chunks and discuss your findings in the figure.
# Include and execute your code here
(ggplot(df, aes(x="flipper_length_mm", y="body_mass_g", color="species"))
+ geom_point()
)this chart why similar to the first chart adds a line to show the average rate within each species of Penguin.
# Include and execute your code here
(ggplot(df, aes(x="flipper_length_mm", y="body_mass_g", color="species"))
+ geom_point()
+ geom_smooth(method="lm")
)This chart shows the overall average weight to flipper size combining the three species of penuin.
# Include and execute your code here
(ggplot(df, aes(x="flipper_length_mm", y="body_mass_g"))
+ geom_point(aes(color="species"))
+ geom_smooth(method="lm")
)this chart adds shape to the three species of penguin so that you can dicern between the species.
# Include and execute your code here
(ggplot(df, aes(x="flipper_length_mm", y="body_mass_g"))
+ geom_point(aes(color="species", shape="species"))
+ geom_smooth(method="lm")
+ labs(
title="Body mass and flipper length",
subtitle="Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
x="Flipper length (mm)",
y="Body mass (g)",
color="Species",
shape="Species"
)
)this Chart changes the the labels of the chart, allowing for a more clearer understand of the chart that your looking at.